package com.kuangstudy.thread.demo3;

/**
 * @author Losca
 * @date 2021/7/19 19:34
 * 先执行完join线程才可以执行其他线程
 */
public class Demo3 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("vip线程"+i+"来了");
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Demo3 join = new Demo3();
        Thread thread = new Thread(join);
        thread.start();
        for (int i = 0; i < 200; i++) {
            if (i == 10){
               thread.join();//插队
            }
            System.out.println("主线程"+i+"来了");
        }
    }
}
